<?php


abstract class BasesfPatient extends BaseObject  implements Persistent {


	
	protected static $peer;


	
	protected $id;


	
	protected $nom;


	
	protected $prenom;


	
	protected $sexe;


	
	protected $nationalite;


	
	protected $adresse;


	
	protected $code_postal;


	
	protected $ville;


	
	protected $pays;


	
	protected $tel_fixe;


	
	protected $tel_portable;


	
	protected $profession;


	
	protected $incapacite_majeur;


	
	protected $num_secu_sociale;


	
	protected $nom_a_prevenir;


	
	protected $prenom_a_prevenir;


	
	protected $tel_a_prevenir;


	
	protected $remarques;


	
	protected $taille;


	
	protected $poids;


	
	protected $rensei_prescri;


	
	protected $nom_medecin_trait;


	
	protected $adr_medecin_trait;


	
	protected $tel_medecin_trait;


	
	protected $cmu = false;

	
	protected $collsfSejours;

	
	protected $lastsfSejourCriteria = null;

	
	protected $collsfConsultations;

	
	protected $lastsfConsultationCriteria = null;

	
	protected $alreadyInSave = false;

	
	protected $alreadyInValidation = false;

	
	public function getId()
	{

		return $this->id;
	}

	
	public function getNom()
	{

		return $this->nom;
	}

	
	public function getPrenom()
	{

		return $this->prenom;
	}

	
	public function getSexe()
	{

		return $this->sexe;
	}

	
	public function getNationalite()
	{

		return $this->nationalite;
	}

	
	public function getAdresse()
	{

		return $this->adresse;
	}

	
	public function getCodePostal()
	{

		return $this->code_postal;
	}

	
	public function getVille()
	{

		return $this->ville;
	}

	
	public function getPays()
	{

		return $this->pays;
	}

	
	public function getTelFixe()
	{

		return $this->tel_fixe;
	}

	
	public function getTelPortable()
	{

		return $this->tel_portable;
	}

	
	public function getProfession()
	{

		return $this->profession;
	}

	
	public function getIncapaciteMajeur()
	{

		return $this->incapacite_majeur;
	}

	
	public function getNumSecuSociale()
	{

		return $this->num_secu_sociale;
	}

	
	public function getNomAPrevenir()
	{

		return $this->nom_a_prevenir;
	}

	
	public function getPrenomAPrevenir()
	{

		return $this->prenom_a_prevenir;
	}

	
	public function getTelAPrevenir()
	{

		return $this->tel_a_prevenir;
	}

	
	public function getRemarques()
	{

		return $this->remarques;
	}

	
	public function getTaille()
	{

		return $this->taille;
	}

	
	public function getPoids()
	{

		return $this->poids;
	}

	
	public function getRenseiPrescri()
	{

		return $this->rensei_prescri;
	}

	
	public function getNomMedecinTrait()
	{

		return $this->nom_medecin_trait;
	}

	
	public function getAdrMedecinTrait()
	{

		return $this->adr_medecin_trait;
	}

	
	public function getTelMedecinTrait()
	{

		return $this->tel_medecin_trait;
	}

	
	public function getCmu()
	{

		return $this->cmu;
	}

	
	public function setId($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->id !== $v) {
			$this->id = $v;
			$this->modifiedColumns[] = sfPatientPeer::ID;
		}

	} 
	
	public function setNom($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->nom !== $v) {
			$this->nom = $v;
			$this->modifiedColumns[] = sfPatientPeer::NOM;
		}

	} 
	
	public function setPrenom($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->prenom !== $v) {
			$this->prenom = $v;
			$this->modifiedColumns[] = sfPatientPeer::PRENOM;
		}

	} 
	
	public function setSexe($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->sexe !== $v) {
			$this->sexe = $v;
			$this->modifiedColumns[] = sfPatientPeer::SEXE;
		}

	} 
	
	public function setNationalite($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->nationalite !== $v) {
			$this->nationalite = $v;
			$this->modifiedColumns[] = sfPatientPeer::NATIONALITE;
		}

	} 
	
	public function setAdresse($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->adresse !== $v) {
			$this->adresse = $v;
			$this->modifiedColumns[] = sfPatientPeer::ADRESSE;
		}

	} 
	
	public function setCodePostal($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->code_postal !== $v) {
			$this->code_postal = $v;
			$this->modifiedColumns[] = sfPatientPeer::CODE_POSTAL;
		}

	} 
	
	public function setVille($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->ville !== $v) {
			$this->ville = $v;
			$this->modifiedColumns[] = sfPatientPeer::VILLE;
		}

	} 
	
	public function setPays($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->pays !== $v) {
			$this->pays = $v;
			$this->modifiedColumns[] = sfPatientPeer::PAYS;
		}

	} 
	
	public function setTelFixe($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->tel_fixe !== $v) {
			$this->tel_fixe = $v;
			$this->modifiedColumns[] = sfPatientPeer::TEL_FIXE;
		}

	} 
	
	public function setTelPortable($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->tel_portable !== $v) {
			$this->tel_portable = $v;
			$this->modifiedColumns[] = sfPatientPeer::TEL_PORTABLE;
		}

	} 
	
	public function setProfession($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->profession !== $v) {
			$this->profession = $v;
			$this->modifiedColumns[] = sfPatientPeer::PROFESSION;
		}

	} 
	
	public function setIncapaciteMajeur($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->incapacite_majeur !== $v) {
			$this->incapacite_majeur = $v;
			$this->modifiedColumns[] = sfPatientPeer::INCAPACITE_MAJEUR;
		}

	} 
	
	public function setNumSecuSociale($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->num_secu_sociale !== $v) {
			$this->num_secu_sociale = $v;
			$this->modifiedColumns[] = sfPatientPeer::NUM_SECU_SOCIALE;
		}

	} 
	
	public function setNomAPrevenir($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->nom_a_prevenir !== $v) {
			$this->nom_a_prevenir = $v;
			$this->modifiedColumns[] = sfPatientPeer::NOM_A_PREVENIR;
		}

	} 
	
	public function setPrenomAPrevenir($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->prenom_a_prevenir !== $v) {
			$this->prenom_a_prevenir = $v;
			$this->modifiedColumns[] = sfPatientPeer::PRENOM_A_PREVENIR;
		}

	} 
	
	public function setTelAPrevenir($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->tel_a_prevenir !== $v) {
			$this->tel_a_prevenir = $v;
			$this->modifiedColumns[] = sfPatientPeer::TEL_A_PREVENIR;
		}

	} 
	
	public function setRemarques($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->remarques !== $v) {
			$this->remarques = $v;
			$this->modifiedColumns[] = sfPatientPeer::REMARQUES;
		}

	} 
	
	public function setTaille($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->taille !== $v) {
			$this->taille = $v;
			$this->modifiedColumns[] = sfPatientPeer::TAILLE;
		}

	} 
	
	public function setPoids($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->poids !== $v) {
			$this->poids = $v;
			$this->modifiedColumns[] = sfPatientPeer::POIDS;
		}

	} 
	
	public function setRenseiPrescri($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->rensei_prescri !== $v) {
			$this->rensei_prescri = $v;
			$this->modifiedColumns[] = sfPatientPeer::RENSEI_PRESCRI;
		}

	} 
	
	public function setNomMedecinTrait($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->nom_medecin_trait !== $v) {
			$this->nom_medecin_trait = $v;
			$this->modifiedColumns[] = sfPatientPeer::NOM_MEDECIN_TRAIT;
		}

	} 
	
	public function setAdrMedecinTrait($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->adr_medecin_trait !== $v) {
			$this->adr_medecin_trait = $v;
			$this->modifiedColumns[] = sfPatientPeer::ADR_MEDECIN_TRAIT;
		}

	} 
	
	public function setTelMedecinTrait($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->tel_medecin_trait !== $v) {
			$this->tel_medecin_trait = $v;
			$this->modifiedColumns[] = sfPatientPeer::TEL_MEDECIN_TRAIT;
		}

	} 
	
	public function setCmu($v)
	{

		if ($this->cmu !== $v || $v === false) {
			$this->cmu = $v;
			$this->modifiedColumns[] = sfPatientPeer::CMU;
		}

	} 
	
	public function hydrate(ResultSet $rs, $startcol = 1)
	{
		try {

			$this->id = $rs->getInt($startcol + 0);

			$this->nom = $rs->getString($startcol + 1);

			$this->prenom = $rs->getString($startcol + 2);

			$this->sexe = $rs->getString($startcol + 3);

			$this->nationalite = $rs->getString($startcol + 4);

			$this->adresse = $rs->getString($startcol + 5);

			$this->code_postal = $rs->getString($startcol + 6);

			$this->ville = $rs->getString($startcol + 7);

			$this->pays = $rs->getString($startcol + 8);

			$this->tel_fixe = $rs->getString($startcol + 9);

			$this->tel_portable = $rs->getString($startcol + 10);

			$this->profession = $rs->getString($startcol + 11);

			$this->incapacite_majeur = $rs->getString($startcol + 12);

			$this->num_secu_sociale = $rs->getString($startcol + 13);

			$this->nom_a_prevenir = $rs->getString($startcol + 14);

			$this->prenom_a_prevenir = $rs->getString($startcol + 15);

			$this->tel_a_prevenir = $rs->getString($startcol + 16);

			$this->remarques = $rs->getString($startcol + 17);

			$this->taille = $rs->getInt($startcol + 18);

			$this->poids = $rs->getInt($startcol + 19);

			$this->rensei_prescri = $rs->getString($startcol + 20);

			$this->nom_medecin_trait = $rs->getString($startcol + 21);

			$this->adr_medecin_trait = $rs->getString($startcol + 22);

			$this->tel_medecin_trait = $rs->getString($startcol + 23);

			$this->cmu = $rs->getBoolean($startcol + 24);

			$this->resetModified();

			$this->setNew(false);

						return $startcol + 25; 
		} catch (Exception $e) {
			throw new PropelException("Error populating sfPatient object", $e);
		}
	}

	
	public function delete($con = null)
	{
		if ($this->isDeleted()) {
			throw new PropelException("This object has already been deleted.");
		}

		if ($con === null) {
			$con = Propel::getConnection(sfPatientPeer::DATABASE_NAME);
		}

		try {
			$con->begin();
			sfPatientPeer::doDelete($this, $con);
			$this->setDeleted(true);
			$con->commit();
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

	
	public function save($con = null)
	{
		if ($this->isDeleted()) {
			throw new PropelException("You cannot save an object that has been deleted.");
		}

		if ($con === null) {
			$con = Propel::getConnection(sfPatientPeer::DATABASE_NAME);
		}

		try {
			$con->begin();
			$affectedRows = $this->doSave($con);
			$con->commit();
			return $affectedRows;
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

	
	protected function doSave($con)
	{
		$affectedRows = 0; 		if (!$this->alreadyInSave) {
			$this->alreadyInSave = true;


						if ($this->isModified()) {
				if ($this->isNew()) {
					$pk = sfPatientPeer::doInsert($this, $con);
					$affectedRows += 1; 										 										 
					$this->setId($pk);  
					$this->setNew(false);
				} else {
					$affectedRows += sfPatientPeer::doUpdate($this, $con);
				}
				$this->resetModified(); 			}

			if ($this->collsfSejours !== null) {
				foreach($this->collsfSejours as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collsfConsultations !== null) {
				foreach($this->collsfConsultations as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			$this->alreadyInSave = false;
		}
		return $affectedRows;
	} 
	
	protected $validationFailures = array();

	
	public function getValidationFailures()
	{
		return $this->validationFailures;
	}

	
	public function validate($columns = null)
	{
		$res = $this->doValidate($columns);
		if ($res === true) {
			$this->validationFailures = array();
			return true;
		} else {
			$this->validationFailures = $res;
			return false;
		}
	}

	
	protected function doValidate($columns = null)
	{
		if (!$this->alreadyInValidation) {
			$this->alreadyInValidation = true;
			$retval = null;

			$failureMap = array();


			if (($retval = sfPatientPeer::doValidate($this, $columns)) !== true) {
				$failureMap = array_merge($failureMap, $retval);
			}


				if ($this->collsfSejours !== null) {
					foreach($this->collsfSejours as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collsfConsultations !== null) {
					foreach($this->collsfConsultations as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}


			$this->alreadyInValidation = false;
		}

		return (!empty($failureMap) ? $failureMap : true);
	}

	
	public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
	{
		$pos = sfPatientPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
		return $this->getByPosition($pos);
	}

	
	public function getByPosition($pos)
	{
		switch($pos) {
			case 0:
				return $this->getId();
				break;
			case 1:
				return $this->getNom();
				break;
			case 2:
				return $this->getPrenom();
				break;
			case 3:
				return $this->getSexe();
				break;
			case 4:
				return $this->getNationalite();
				break;
			case 5:
				return $this->getAdresse();
				break;
			case 6:
				return $this->getCodePostal();
				break;
			case 7:
				return $this->getVille();
				break;
			case 8:
				return $this->getPays();
				break;
			case 9:
				return $this->getTelFixe();
				break;
			case 10:
				return $this->getTelPortable();
				break;
			case 11:
				return $this->getProfession();
				break;
			case 12:
				return $this->getIncapaciteMajeur();
				break;
			case 13:
				return $this->getNumSecuSociale();
				break;
			case 14:
				return $this->getNomAPrevenir();
				break;
			case 15:
				return $this->getPrenomAPrevenir();
				break;
			case 16:
				return $this->getTelAPrevenir();
				break;
			case 17:
				return $this->getRemarques();
				break;
			case 18:
				return $this->getTaille();
				break;
			case 19:
				return $this->getPoids();
				break;
			case 20:
				return $this->getRenseiPrescri();
				break;
			case 21:
				return $this->getNomMedecinTrait();
				break;
			case 22:
				return $this->getAdrMedecinTrait();
				break;
			case 23:
				return $this->getTelMedecinTrait();
				break;
			case 24:
				return $this->getCmu();
				break;
			default:
				return null;
				break;
		} 	}

	
	public function toArray($keyType = BasePeer::TYPE_PHPNAME)
	{
		$keys = sfPatientPeer::getFieldNames($keyType);
		$result = array(
			$keys[0] => $this->getId(),
			$keys[1] => $this->getNom(),
			$keys[2] => $this->getPrenom(),
			$keys[3] => $this->getSexe(),
			$keys[4] => $this->getNationalite(),
			$keys[5] => $this->getAdresse(),
			$keys[6] => $this->getCodePostal(),
			$keys[7] => $this->getVille(),
			$keys[8] => $this->getPays(),
			$keys[9] => $this->getTelFixe(),
			$keys[10] => $this->getTelPortable(),
			$keys[11] => $this->getProfession(),
			$keys[12] => $this->getIncapaciteMajeur(),
			$keys[13] => $this->getNumSecuSociale(),
			$keys[14] => $this->getNomAPrevenir(),
			$keys[15] => $this->getPrenomAPrevenir(),
			$keys[16] => $this->getTelAPrevenir(),
			$keys[17] => $this->getRemarques(),
			$keys[18] => $this->getTaille(),
			$keys[19] => $this->getPoids(),
			$keys[20] => $this->getRenseiPrescri(),
			$keys[21] => $this->getNomMedecinTrait(),
			$keys[22] => $this->getAdrMedecinTrait(),
			$keys[23] => $this->getTelMedecinTrait(),
			$keys[24] => $this->getCmu(),
		);
		return $result;
	}

	
	public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
	{
		$pos = sfPatientPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
		return $this->setByPosition($pos, $value);
	}

	
	public function setByPosition($pos, $value)
	{
		switch($pos) {
			case 0:
				$this->setId($value);
				break;
			case 1:
				$this->setNom($value);
				break;
			case 2:
				$this->setPrenom($value);
				break;
			case 3:
				$this->setSexe($value);
				break;
			case 4:
				$this->setNationalite($value);
				break;
			case 5:
				$this->setAdresse($value);
				break;
			case 6:
				$this->setCodePostal($value);
				break;
			case 7:
				$this->setVille($value);
				break;
			case 8:
				$this->setPays($value);
				break;
			case 9:
				$this->setTelFixe($value);
				break;
			case 10:
				$this->setTelPortable($value);
				break;
			case 11:
				$this->setProfession($value);
				break;
			case 12:
				$this->setIncapaciteMajeur($value);
				break;
			case 13:
				$this->setNumSecuSociale($value);
				break;
			case 14:
				$this->setNomAPrevenir($value);
				break;
			case 15:
				$this->setPrenomAPrevenir($value);
				break;
			case 16:
				$this->setTelAPrevenir($value);
				break;
			case 17:
				$this->setRemarques($value);
				break;
			case 18:
				$this->setTaille($value);
				break;
			case 19:
				$this->setPoids($value);
				break;
			case 20:
				$this->setRenseiPrescri($value);
				break;
			case 21:
				$this->setNomMedecinTrait($value);
				break;
			case 22:
				$this->setAdrMedecinTrait($value);
				break;
			case 23:
				$this->setTelMedecinTrait($value);
				break;
			case 24:
				$this->setCmu($value);
				break;
		} 	}

	
	public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
	{
		$keys = sfPatientPeer::getFieldNames($keyType);

		if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
		if (array_key_exists($keys[1], $arr)) $this->setNom($arr[$keys[1]]);
		if (array_key_exists($keys[2], $arr)) $this->setPrenom($arr[$keys[2]]);
		if (array_key_exists($keys[3], $arr)) $this->setSexe($arr[$keys[3]]);
		if (array_key_exists($keys[4], $arr)) $this->setNationalite($arr[$keys[4]]);
		if (array_key_exists($keys[5], $arr)) $this->setAdresse($arr[$keys[5]]);
		if (array_key_exists($keys[6], $arr)) $this->setCodePostal($arr[$keys[6]]);
		if (array_key_exists($keys[7], $arr)) $this->setVille($arr[$keys[7]]);
		if (array_key_exists($keys[8], $arr)) $this->setPays($arr[$keys[8]]);
		if (array_key_exists($keys[9], $arr)) $this->setTelFixe($arr[$keys[9]]);
		if (array_key_exists($keys[10], $arr)) $this->setTelPortable($arr[$keys[10]]);
		if (array_key_exists($keys[11], $arr)) $this->setProfession($arr[$keys[11]]);
		if (array_key_exists($keys[12], $arr)) $this->setIncapaciteMajeur($arr[$keys[12]]);
		if (array_key_exists($keys[13], $arr)) $this->setNumSecuSociale($arr[$keys[13]]);
		if (array_key_exists($keys[14], $arr)) $this->setNomAPrevenir($arr[$keys[14]]);
		if (array_key_exists($keys[15], $arr)) $this->setPrenomAPrevenir($arr[$keys[15]]);
		if (array_key_exists($keys[16], $arr)) $this->setTelAPrevenir($arr[$keys[16]]);
		if (array_key_exists($keys[17], $arr)) $this->setRemarques($arr[$keys[17]]);
		if (array_key_exists($keys[18], $arr)) $this->setTaille($arr[$keys[18]]);
		if (array_key_exists($keys[19], $arr)) $this->setPoids($arr[$keys[19]]);
		if (array_key_exists($keys[20], $arr)) $this->setRenseiPrescri($arr[$keys[20]]);
		if (array_key_exists($keys[21], $arr)) $this->setNomMedecinTrait($arr[$keys[21]]);
		if (array_key_exists($keys[22], $arr)) $this->setAdrMedecinTrait($arr[$keys[22]]);
		if (array_key_exists($keys[23], $arr)) $this->setTelMedecinTrait($arr[$keys[23]]);
		if (array_key_exists($keys[24], $arr)) $this->setCmu($arr[$keys[24]]);
	}

	
	public function buildCriteria()
	{
		$criteria = new Criteria(sfPatientPeer::DATABASE_NAME);

		if ($this->isColumnModified(sfPatientPeer::ID)) $criteria->add(sfPatientPeer::ID, $this->id);
		if ($this->isColumnModified(sfPatientPeer::NOM)) $criteria->add(sfPatientPeer::NOM, $this->nom);
		if ($this->isColumnModified(sfPatientPeer::PRENOM)) $criteria->add(sfPatientPeer::PRENOM, $this->prenom);
		if ($this->isColumnModified(sfPatientPeer::SEXE)) $criteria->add(sfPatientPeer::SEXE, $this->sexe);
		if ($this->isColumnModified(sfPatientPeer::NATIONALITE)) $criteria->add(sfPatientPeer::NATIONALITE, $this->nationalite);
		if ($this->isColumnModified(sfPatientPeer::ADRESSE)) $criteria->add(sfPatientPeer::ADRESSE, $this->adresse);
		if ($this->isColumnModified(sfPatientPeer::CODE_POSTAL)) $criteria->add(sfPatientPeer::CODE_POSTAL, $this->code_postal);
		if ($this->isColumnModified(sfPatientPeer::VILLE)) $criteria->add(sfPatientPeer::VILLE, $this->ville);
		if ($this->isColumnModified(sfPatientPeer::PAYS)) $criteria->add(sfPatientPeer::PAYS, $this->pays);
		if ($this->isColumnModified(sfPatientPeer::TEL_FIXE)) $criteria->add(sfPatientPeer::TEL_FIXE, $this->tel_fixe);
		if ($this->isColumnModified(sfPatientPeer::TEL_PORTABLE)) $criteria->add(sfPatientPeer::TEL_PORTABLE, $this->tel_portable);
		if ($this->isColumnModified(sfPatientPeer::PROFESSION)) $criteria->add(sfPatientPeer::PROFESSION, $this->profession);
		if ($this->isColumnModified(sfPatientPeer::INCAPACITE_MAJEUR)) $criteria->add(sfPatientPeer::INCAPACITE_MAJEUR, $this->incapacite_majeur);
		if ($this->isColumnModified(sfPatientPeer::NUM_SECU_SOCIALE)) $criteria->add(sfPatientPeer::NUM_SECU_SOCIALE, $this->num_secu_sociale);
		if ($this->isColumnModified(sfPatientPeer::NOM_A_PREVENIR)) $criteria->add(sfPatientPeer::NOM_A_PREVENIR, $this->nom_a_prevenir);
		if ($this->isColumnModified(sfPatientPeer::PRENOM_A_PREVENIR)) $criteria->add(sfPatientPeer::PRENOM_A_PREVENIR, $this->prenom_a_prevenir);
		if ($this->isColumnModified(sfPatientPeer::TEL_A_PREVENIR)) $criteria->add(sfPatientPeer::TEL_A_PREVENIR, $this->tel_a_prevenir);
		if ($this->isColumnModified(sfPatientPeer::REMARQUES)) $criteria->add(sfPatientPeer::REMARQUES, $this->remarques);
		if ($this->isColumnModified(sfPatientPeer::TAILLE)) $criteria->add(sfPatientPeer::TAILLE, $this->taille);
		if ($this->isColumnModified(sfPatientPeer::POIDS)) $criteria->add(sfPatientPeer::POIDS, $this->poids);
		if ($this->isColumnModified(sfPatientPeer::RENSEI_PRESCRI)) $criteria->add(sfPatientPeer::RENSEI_PRESCRI, $this->rensei_prescri);
		if ($this->isColumnModified(sfPatientPeer::NOM_MEDECIN_TRAIT)) $criteria->add(sfPatientPeer::NOM_MEDECIN_TRAIT, $this->nom_medecin_trait);
		if ($this->isColumnModified(sfPatientPeer::ADR_MEDECIN_TRAIT)) $criteria->add(sfPatientPeer::ADR_MEDECIN_TRAIT, $this->adr_medecin_trait);
		if ($this->isColumnModified(sfPatientPeer::TEL_MEDECIN_TRAIT)) $criteria->add(sfPatientPeer::TEL_MEDECIN_TRAIT, $this->tel_medecin_trait);
		if ($this->isColumnModified(sfPatientPeer::CMU)) $criteria->add(sfPatientPeer::CMU, $this->cmu);

		return $criteria;
	}

	
	public function buildPkeyCriteria()
	{
		$criteria = new Criteria(sfPatientPeer::DATABASE_NAME);

		$criteria->add(sfPatientPeer::ID, $this->id);

		return $criteria;
	}

	
	public function getPrimaryKey()
	{
		return $this->getId();
	}

	
	public function setPrimaryKey($key)
	{
		$this->setId($key);
	}

	
	public function copyInto($copyObj, $deepCopy = false)
	{

		$copyObj->setNom($this->nom);

		$copyObj->setPrenom($this->prenom);

		$copyObj->setSexe($this->sexe);

		$copyObj->setNationalite($this->nationalite);

		$copyObj->setAdresse($this->adresse);

		$copyObj->setCodePostal($this->code_postal);

		$copyObj->setVille($this->ville);

		$copyObj->setPays($this->pays);

		$copyObj->setTelFixe($this->tel_fixe);

		$copyObj->setTelPortable($this->tel_portable);

		$copyObj->setProfession($this->profession);

		$copyObj->setIncapaciteMajeur($this->incapacite_majeur);

		$copyObj->setNumSecuSociale($this->num_secu_sociale);

		$copyObj->setNomAPrevenir($this->nom_a_prevenir);

		$copyObj->setPrenomAPrevenir($this->prenom_a_prevenir);

		$copyObj->setTelAPrevenir($this->tel_a_prevenir);

		$copyObj->setRemarques($this->remarques);

		$copyObj->setTaille($this->taille);

		$copyObj->setPoids($this->poids);

		$copyObj->setRenseiPrescri($this->rensei_prescri);

		$copyObj->setNomMedecinTrait($this->nom_medecin_trait);

		$copyObj->setAdrMedecinTrait($this->adr_medecin_trait);

		$copyObj->setTelMedecinTrait($this->tel_medecin_trait);

		$copyObj->setCmu($this->cmu);


		if ($deepCopy) {
									$copyObj->setNew(false);

			foreach($this->getsfSejours() as $relObj) {
				$copyObj->addsfSejour($relObj->copy($deepCopy));
			}

			foreach($this->getsfConsultations() as $relObj) {
				$copyObj->addsfConsultation($relObj->copy($deepCopy));
			}

		} 

		$copyObj->setNew(true);

		$copyObj->setId(NULL); 
	}

	
	public function copy($deepCopy = false)
	{
				$clazz = get_class($this);
		$copyObj = new $clazz();
		$this->copyInto($copyObj, $deepCopy);
		return $copyObj;
	}

	
	public function getPeer()
	{
		if (self::$peer === null) {
			self::$peer = new sfPatientPeer();
		}
		return self::$peer;
	}

	
	public function initsfSejours()
	{
		if ($this->collsfSejours === null) {
			$this->collsfSejours = array();
		}
	}

	
	public function getsfSejours($criteria = null, $con = null)
	{
				include_once 'lib/model/om/BasesfSejourPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collsfSejours === null) {
			if ($this->isNew()) {
			   $this->collsfSejours = array();
			} else {

				$criteria->add(sfSejourPeer::PATIENT_ID, $this->getId());

				sfSejourPeer::addSelectColumns($criteria);
				$this->collsfSejours = sfSejourPeer::doSelect($criteria, $con);
			}
		} else {
						if (!$this->isNew()) {
												

				$criteria->add(sfSejourPeer::PATIENT_ID, $this->getId());

				sfSejourPeer::addSelectColumns($criteria);
				if (!isset($this->lastsfSejourCriteria) || !$this->lastsfSejourCriteria->equals($criteria)) {
					$this->collsfSejours = sfSejourPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastsfSejourCriteria = $criteria;
		return $this->collsfSejours;
	}

	
	public function countsfSejours($criteria = null, $distinct = false, $con = null)
	{
				include_once 'lib/model/om/BasesfSejourPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(sfSejourPeer::PATIENT_ID, $this->getId());

		return sfSejourPeer::doCount($criteria, $distinct, $con);
	}

	
	public function addsfSejour(sfSejour $l)
	{
		$this->collsfSejours[] = $l;
		$l->setsfPatient($this);
	}


	
	public function getsfSejoursJoinsfChambre($criteria = null, $con = null)
	{
				include_once 'lib/model/om/BasesfSejourPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collsfSejours === null) {
			if ($this->isNew()) {
				$this->collsfSejours = array();
			} else {

				$criteria->add(sfSejourPeer::PATIENT_ID, $this->getId());

				$this->collsfSejours = sfSejourPeer::doSelectJoinsfChambre($criteria, $con);
			}
		} else {
									
			$criteria->add(sfSejourPeer::PATIENT_ID, $this->getId());

			if (!isset($this->lastsfSejourCriteria) || !$this->lastsfSejourCriteria->equals($criteria)) {
				$this->collsfSejours = sfSejourPeer::doSelectJoinsfChambre($criteria, $con);
			}
		}
		$this->lastsfSejourCriteria = $criteria;

		return $this->collsfSejours;
	}

	
	public function initsfConsultations()
	{
		if ($this->collsfConsultations === null) {
			$this->collsfConsultations = array();
		}
	}

	
	public function getsfConsultations($criteria = null, $con = null)
	{
				include_once 'lib/model/om/BasesfConsultationPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collsfConsultations === null) {
			if ($this->isNew()) {
			   $this->collsfConsultations = array();
			} else {

				$criteria->add(sfConsultationPeer::PATIENT_ID, $this->getId());

				sfConsultationPeer::addSelectColumns($criteria);
				$this->collsfConsultations = sfConsultationPeer::doSelect($criteria, $con);
			}
		} else {
						if (!$this->isNew()) {
												

				$criteria->add(sfConsultationPeer::PATIENT_ID, $this->getId());

				sfConsultationPeer::addSelectColumns($criteria);
				if (!isset($this->lastsfConsultationCriteria) || !$this->lastsfConsultationCriteria->equals($criteria)) {
					$this->collsfConsultations = sfConsultationPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastsfConsultationCriteria = $criteria;
		return $this->collsfConsultations;
	}

	
	public function countsfConsultations($criteria = null, $distinct = false, $con = null)
	{
				include_once 'lib/model/om/BasesfConsultationPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(sfConsultationPeer::PATIENT_ID, $this->getId());

		return sfConsultationPeer::doCount($criteria, $distinct, $con);
	}

	
	public function addsfConsultation(sfConsultation $l)
	{
		$this->collsfConsultations[] = $l;
		$l->setsfPatient($this);
	}


	
	public function getsfConsultationsJoinsfGuardUserProfile($criteria = null, $con = null)
	{
				include_once 'lib/model/om/BasesfConsultationPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collsfConsultations === null) {
			if ($this->isNew()) {
				$this->collsfConsultations = array();
			} else {

				$criteria->add(sfConsultationPeer::PATIENT_ID, $this->getId());

				$this->collsfConsultations = sfConsultationPeer::doSelectJoinsfGuardUserProfile($criteria, $con);
			}
		} else {
									
			$criteria->add(sfConsultationPeer::PATIENT_ID, $this->getId());

			if (!isset($this->lastsfConsultationCriteria) || !$this->lastsfConsultationCriteria->equals($criteria)) {
				$this->collsfConsultations = sfConsultationPeer::doSelectJoinsfGuardUserProfile($criteria, $con);
			}
		}
		$this->lastsfConsultationCriteria = $criteria;

		return $this->collsfConsultations;
	}


	
	public function getsfConsultationsJoinsfTypeConsultation($criteria = null, $con = null)
	{
				include_once 'lib/model/om/BasesfConsultationPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collsfConsultations === null) {
			if ($this->isNew()) {
				$this->collsfConsultations = array();
			} else {

				$criteria->add(sfConsultationPeer::PATIENT_ID, $this->getId());

				$this->collsfConsultations = sfConsultationPeer::doSelectJoinsfTypeConsultation($criteria, $con);
			}
		} else {
									
			$criteria->add(sfConsultationPeer::PATIENT_ID, $this->getId());

			if (!isset($this->lastsfConsultationCriteria) || !$this->lastsfConsultationCriteria->equals($criteria)) {
				$this->collsfConsultations = sfConsultationPeer::doSelectJoinsfTypeConsultation($criteria, $con);
			}
		}
		$this->lastsfConsultationCriteria = $criteria;

		return $this->collsfConsultations;
	}

} 